package c.e.a.b.f.b;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/* compiled from: com.google.android.gms:play-services-measurement@@18.0.0 */
public class b4 extends BroadcastReceiver {
    public final k9 a;
    public boolean b;
    public boolean c;

    static {
        Class cls = b4.class;
    }

    public b4(k9 k9Var) {
        this.a = k9Var;
    }

    public final void a() {
        this.a.P();
        this.a.a().g();
        this.a.a().g();
        if (this.b) {
            this.a.d().n.a("Unregistering connectivity change receiver");
            this.b = false;
            this.c = false;
            try {
                this.a.j.a.unregisterReceiver(this);
            } catch (IllegalArgumentException e) {
                this.a.d().f.b("Failed to unregister the network broadcast receiver", e);
            }
        }
    }

    public void onReceive(Context context, Intent intent) {
        this.a.P();
        String action = intent.getAction();
        this.a.d().n.b("NetworkBroadcastReceiver received action", action);
        if ("android.net.conn.CONNECTIVITY_CHANGE".equals(action)) {
            boolean u = this.a.J().u();
            if (this.c != u) {
                this.c = u;
                this.a.a().v(new e4(this, u));
            }
            return;
        }
        this.a.d().i.b("NetworkBroadcastReceiver received unknown action", action);
    }
}
